<template>
  <div class="grandSon">
    <h1>孙子：收到祖父的钱和车</h1>
    <h2>子：{{ car }}</h2>
    <h2>子：{{ money }}</h2>
    <button @click="cutMoney(100)">花掉祖父钱</button>
  </div>
</template>
<script setup lang="ts">
import { inject } from "vue";
let car = inject("car", "无车");
let { money, cutMoney } = inject("money", {
  money: 0,
  cutMoney: (num: number) => {},
});
</script>
<style scoped lang="scss">
.grandSon {
  border: 1px solid red;
  background: saddlebrown;
}
</style>
